#!/bin/sh
distro_and_arch="$1"
if [ -z "$distro_and_arch" ]; then
  echo "Usage: $0 <distro-arch>"
  exit 1
fi
distro=`echo "$distro_and_arch" | cut -f1 -d-`
arch=`echo "$distro_and_arch" | cut -f2 -d-`

ADDPATH="/usr/bin/util-grace/"
if [ -d $ADDPATH ]; then
    export PATH=$PATH:$ADDPATH
fi

if [ ! -e ./build-${distro}.sh ]; then
  echo "Could not find build-script for distro '${distro}'"
  exit 1
fi
./build-${distro}.sh ${arch} || tail -40 /var/log/openpanel-build.log
